The Unity Editor is a popular and useful authoring platform for creating cutting-edge augmented reality experiences for handheld devices and digital eyewear. Visit https://unity.com to download and set up Unity. Add the Vuforia Engine Extension to your project, or start with our Core Samples in the Unity Asset Store.
NOTE: If your project targets Android API level 31 or above, we recommend updating to Vuforia Engine 10.8 or later. Updating will automatically add the manifest permission to allow data retrieval from sensors on Android devices using the VISLAM. Or, you can manually add the permission android.permission.HIGH_SAMPLING_RATE_SENSORS in the manifest file in Unity.
About Vuforia EngineVuforia Engine is a software development kit (SDK) for creating Augmented Reality apps. With the SDK, you add advanced computer vision functionality to your application, allowing it to recognize images, objects, and spaces with intuitive options to configure your app to interact with the real world.
Vuforia Engine supports AR app development for Android, iOS, Magic Leap, and UWP devices. See: Vuforia Engine Supported Versions
This Getting Started guide will show you the following:
How to add Vuforia Engine to your Unity project.How to set up Vuforia Engine’s Image Targets in Unity. How to add content and test your AR app.Adding Vuforia Engine to a Unity projectCreate an empty Unity project or open one of your existing Unity projects.
In the Unity Hub, create a New Project and select the Unity version currently supported by Vuforia Engine.Select the 3D or 3D (URP) core template and enter a name for your Unity project.NOTE: Only the Vuforia Engine Extension is supported in URP. The Vuforia Core Samples and the Vuforia VFX Library are incompatible with URP since they contain unsupported assets.Create Project to open the empty Unity Project.Add Vuforia Engine ExtensionThe Vuforia Engine Extension is a Unity Asset Package that can be imported into your Unity project.
Download the extension with the installer script from the Developer portal: Vuforia Engine Extension for Unity. Or, choose one of the alternative import methods documented in Vuforia Engine Package Hosting for Unity.Import the downloaded Unity Asset Package from the menu Assets -> Import Package -> Custom Package...Importing the package will let a script make the necessary changes in your Unity project to install or upgrade to the latest Vuforia Engine SDK. See which version you currently have in your project in the Package Manager in the Window tab.To manually check if new updates are available, go to Help -> Vuforia Engine -> Check for Updates:
Vuforia Engine SetupThe Vuforia Engine is visible in the GameObject Menu after it is imported.
A missing menu could indicate that the Vuforia Engine needs to be imported.
Each scene that tracks and renders augmented content requires an ARCamera GameObject. It supports apps for both handheld devices and digital eyewear.
Steps:
Add an ARCamera GameObject from the Vuforia Engine menu. Select the ARCamera and Open Vuforia Configuration (CMD+Shift+V or Ctrl+Shift+V) from the Inspector.Add a Vuforia Developer license key in the App License Key field. Add License opens the License Manager in a browser window. For a guide on getting a license key, see Engine Developer Portal Licenses.NOTE: Although measures are taken to store your license key securely, we recommend utilizing additional encryption solutions to further enhance your key's security.Tip: You can delete the default Main Camera after adding an ARCamera. The ARCamera also contains a Camera component. The Main Camera is unnecessary unless you use it to render a specific camera overlay, e.g., user interface or minimap.
Adding Vuforia Engine FeaturesAfter activating Vuforia Engine in Unity, you can add features from the Vuforia Engine menu to your project from the Unity GameObject Menu.
Please refer to Features Overview for more information on all of the capabilities the Vuforia Engine offers.
You can also add the Vuforia Core Samples from Unity’s Asset Store. The Core Samples include and demonstrate many of the Vuforia Engine Features. The steps below continue to set up a simple Vuforia AR scene.
Steps:
Navigate to the Vuforia Engine Menu and select Image Target. or any other targets you wish to use. The Features Overview linked just above provides guides for using other targets.Each Vuforia Engine GameObject is configured in the Inspector. When a target is added, it will appear in the Hierarchy.
Select the Image Target GameObject from the Hierarchy and choose from the Type dropdown eitherFrom Image – Please see Instant Image Targets for further steps.From database – Image Target databases can be created in the Target Manager.Cloud Reco – Cloud Databases are also configured in the Target Manager. See Cloud Recognition for more information.In this example, we select From Database.If there is no database with Image Targets in the project, Vuforia Engine will ask if you wish to Import a Default Image Target Database in a pop-up window.
Click Import. On most Vuforia targets, you can set an Optimize Tracking For mode that improves tracking for particular use cases. Select between Default and AR_Controller. Model Targets have an additional mode: Low_Feature_Objects. See Optimizing Model Target Tracking for information on the modes.TIP: Always maintain an accurate scale between the Vuforia targets and the physical prints or objects. Using targets that deviate in size from the real-life object might impact the tracking quality. See Virtual Scene Scale in Unity for more information.
All Vuforia Targets include the following:
A Vuforia Behaviour component lets you choose your target from a database and configure the target’s properties.A ObserverEventHandler that lets you assign events and render conditions based on the tracking information returned by its Status and StatusInfo.A Target preview that lets you control whether the target preview should be visible in the scene during authoring.On many Vuforia Targets, you can Add Occlusion Object and Add Target Representation. They are created as a child of the target.
The Occlusion Object adds a GameObject of the model with an occlusion material that lets your object visually obstruct digital content.The Target Representation adds a GameObject of the model with the original material and mesh of the target. It helps apply shaders and colliders or highlight parts of the tracked object.NOTE: Virtual Scene Scale will not re-scale the occlusion object or target representation. Add the objects again after applying a value to the Virtual Scene Scale Factor.
NOTE: Area Targets are created with a pre-computed preview mesh. The settings to add occlusion or colliders are available in the AreaTargetBehaviour component. See Area Targets in Unity for details.
Upgrade your Vuforia target previewsFrom Vuforia Engine SDK 10.8 and forward, the Vuforia target preview representations are changed to improve the development workflow. Upgrading your project to the latest SDK will display a message on your Vuforia Targets asking you to Upgrade This Target or Open Upgrade Dialog.
Click Upgrade This Target to upgrade the target to the new representation setup. See Adding Vuforia Engine Features to see how that looks.
IMPORTANT: Upgrading alters the Vuforia target by removing the old preview that is a child of the Vuforia target. Pointers and references to the old preview should be updated to use a Target Representation instead.
Click the Open Upgrade Dialog to update all former previews in the scene or all former previews in all scenes in the project.
Adding Digital AssetsAdd digital content to your target as children of the target. This way, augmented content is only shown when that target is tracked.
Add content as a child of the target by dragging your content on top of the target. Add a simple Cube from GameObject -> 3D Object -> Cube or place content from Unity’s Asset Store or the Core Samples as pictured above.See also the Vuforia VFX Library for free assets and shaders to style your AR app.Print Physical TargetsA Vuforia target is, in most cases, a physical print or object. You can find these in /Editor/Vuforia/ForPrint as PDFs if you have imported the Core Samples. All printable Vuforia targets are also available here: Printable Target PDFs.
Print without scaling.
Playing the SceneTo see your scene in action, you can use the Vuforia Engine Play Mode in the Game View, which you can activate by clicking the Play button. Use Play Mode to evaluate and rapidly prototype your scene(s) without deploying to a device.
Play Mode is configured in the Vuforia Configuration section, and you may use a webcam, simulator mode, or recording mode to test your Vuforia targets. See Vuforia Play Mode in Unity for more information.
Building and Running your AppVuforia Engine-powered Unity apps are built and run like other Unity apps for Android, iOS, and UWP.
When switching platforms between iOS and Android in the Build Settings, remember that Vuforia Engine sets and unsets the Render Over Native UI automatically.
See Unity’s tutorial on building for mobile and their documentation for build settings on all supported platforms.
Configuring a project for Digital EyewearVuforia Engine supports a variety of optical and video see-through stereo rendering displays, including HoloLens, Magic Leap, and Vuzix M400. Refer to the Digital Eyewear article for more information.
Next StepsEssentialsVuforia Engine Package Hosting for Unity
Vuforia Play Mode in Unity
Working with Vuforia Engine in Unity
Learn MoreHow to Create and Load Targets in Unity
Virtual Scene Scale Factor in Unity
Using ARCore in Unity
Building Large Vuforia Engine Apps in Unity